<%@ Page Language="C#"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="JSClass" %>
<%
    String start = Request["start"];
    String end = Request["end"];
	
	StringBuilder sb = new StringBuilder();
    sb.Append("SELECT * \n");
    sb.Append("FROM \n");
    sb.Append("( \n");
    
	//sb.Append("SELECT ROWNUM RNUM,PNU,ADDRESSNAME , FN_GETJIBEONASPNU(PNU) JIBEON, MYEONJEOK \n");
    //sb.Append("FROM HYUGESO_FIELD A , CODE_HJGYV B \n");
    //sb.Append("WHERE ADMINCODE=HJGYCODE AND ISONNARA IS NULL \n");
    
	sb.Append("SELECT ROWNUM RNUM , PNU , ADDRESSNAME , FN_GETJIBEONASPNU(PNU) JIBEON, AREA_ MYEONJEOK \n");
	sb.Append("FROM EXGIS2011_JIBEON_1113 A , CODE_HJGYV B  \n");
	sb.Append("WHERE ADMINCODE=HJGYCODE \n");
	sb.Append("	AND A.AREA_=0  \n");
	sb.Append("	AND A.NSCODE='0100' \n");
	sb.Append("	AND SYYEOBU = '1' AND YDGUBUN IN (SELECT CODE FROM CODE_YONGDO) \n");
	
	sb.Append(") \n");
    sb.Append("WHERE RNUM >= " + start + " AND RNUM <= " + end + " \n");
	
	TableQuery myQuery = new TableQuery(sb.ToString());
    Response.Write(myQuery.GetJSON());
    %>